import { TemplateView } from "../general/TemplateView";
import {ListView} from "../general/ListView";

class NodeItemView extends TemplateView {
    render(t, vm) {
        return t.div([
            t.button({
                className: "button-node",
                onClick: () => {vm.setHomeserver(vm.name)}
            },vm => vm.name),
        ]);
    }
}

export class NodeView extends TemplateView{
    
    render(t,vm){
        const nodeList = new ListView({
            list: vm.node,
            parentProvidesUpdates: false,
        }, info => {
            return new NodeItemView(info);
        });


        return t.div([
            // t.div({className:'node_box_head'},[
            //     t.div({className:'button-utility1'}),
            //     t.h1({className:'tit'},vm.i18n`Node`),
            //     t.button({
            //         className: "button-utility LoginView_more",
            //         onClick: () => vm.hideNode(false),
            //     }),
            // ]),
            t.view(nodeList),
        ])
    }
}